<?php 
/**
 * @todo 删除好友关系
 * @param friendid=>好友id method=>get
 * @author 马超
 */
define('_VIEW_MODEL_','default');
session_start();
require_once("./init.php");
$friendId = intval($friendid); //get方式传过来的好友id
$uId      = isset($_SESSION['id'])?$_SESSION['id']:null; //用户id

if(empty($uId)){ //验证没有登录禁止访问
	errorPrompt('no_login','login.php');exit;
}

if($rowInfo = $db->getAll("select id from {$telper}friend where userid in('$uId','$friendId') and friendid in ('$uId','$friendId')")){
	foreach ($rowInfo as $val){
		$rowId = isset($val['id'])?$val['id']:0;
		$db->Execute("update {$telper}friend set state='1' where id='$rowId'");
	}
}

header("Content-type:text/vnd.wap.wml;charset=utf-8");
$smartyObj->display('delfriend.tpl');
?>